<!doctype HTML public "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- Click to Convert 5.2: Anything to HTML -->
<!-- http://www.clicktoconvert.com -->

<html>
<head>
<title>gravityboxscheduleuserguide - page 57 of 234</title>
<meta http-equiv=content-type content=text/html;charset=iso-8859-1>
<meta name="Generator" content="Click to Convert">

<!--Start of page styles-->
<STYLE TYPE="text/css">
<!--
 /* Foreground Image Styles */

 /* Position Styles */
 .ts57p0{position:absolute;left:106px;top:97px;}
 .ts57p1{position:absolute;left:352px;top:97px;}
 .ts57p3{position:absolute;left:672px;top:97px;}
 .ts57p7{position:absolute;left:106px;top:113px;}
 .ts57p8{position:absolute;left:706px;top:1026px;}
 .ts57p9{position:absolute;left:331px;top:1044px;}
 .ts57p13{position:absolute;left:106px;top:146px;}
 .ts57p15{position:absolute;left:106px;top:220px;}
 .ts57p17{position:absolute;left:106px;top:256px;}
 .ts57p18{position:absolute;left:106px;top:275px;}
 .ts57p19{position:absolute;left:106px;top:293px;}
 .ts57p21{position:absolute;left:106px;top:312px;}
 .ts57p22{position:absolute;left:106px;top:330px;}
 .ts57p23{position:absolute;left:106px;top:348px;}
 .ts57p25{position:absolute;left:106px;top:367px;}
 .ts57p26{position:absolute;left:106px;top:385px;}
 .ts57p27{position:absolute;left:106px;top:404px;}
 .ts57p29{position:absolute;left:106px;top:422px;}
 .ts57p30{position:absolute;left:106px;top:440px;}
 .ts57p31{position:absolute;left:106px;top:459px;}
 .ts57p34{position:absolute;left:106px;top:477px;}
 .ts57p35{position:absolute;left:154px;top:477px;}
 .ts57p36{position:absolute;left:106px;top:496px;}
 .ts57p38{position:absolute;left:106px;top:532px;}
 .ts57p39{position:absolute;left:106px;top:551px;}
 .ts57p41{position:absolute;left:106px;top:569px;}
 .ts57p42{position:absolute;left:106px;top:588px;}
 .ts57p44{position:absolute;left:106px;top:606px;}
 .ts57p45{position:absolute;left:106px;top:624px;}
 .ts57p46{position:absolute;left:106px;top:643px;}
 .ts57p50{position:absolute;left:106px;top:661px;}
 .ts57p51{position:absolute;left:106px;top:680px;}
 .ts57p52{position:absolute;left:106px;top:698px;}
 .ts57p55{position:absolute;left:106px;top:716px;}
 .ts57p56{position:absolute;left:106px;top:735px;}
 .ts57p57{position:absolute;left:106px;top:753px;}
 .ts57p58{position:absolute;left:106px;top:772px;}
 .ts57p60{position:absolute;left:106px;top:790px;}
 .ts57p63{position:absolute;left:106px;top:808px;}
 .ts57p65{position:absolute;left:106px;top:827px;}
 .ts57p66{position:absolute;left:106px;top:845px;}
 .ts57p68{position:absolute;left:106px;top:864px;}
 .ts57p70{position:absolute;left:106px;top:882px;}
 .ts57p71{position:absolute;left:106px;top:901px;}
 .ts57p73{position:absolute;left:106px;top:920px;}
 .ts57p75{position:absolute;left:106px;top:938px;}
 .ts57p77{position:absolute;left:106px;top:957px;}

 /* Font Styles */
 .ft0p57{font-style:normal;font-weight:bold;font-size:13px;font-family:arial,sans-serif;color:#000000;}
 .ft1p57{font-weight:normal;}
 .ft2p57{font-style:normal;font-weight:normal;font-size:13px;font-family:"times new roman","times new roman",times,serif;color:#000000;}
 .ft3p57{font-style:normal;font-weight:normal;font-size:16px;font-family:"times new roman","times new roman",times,serif;color:#000000;}
 .ft4p57{font-style:normal;font-weight:bold;font-size:11px;font-family:arial,sans-serif;color:#000000;}
 .ft5p57{font-style:normal;font-weight:normal;font-size:32px;font-family:helvetica,arial,sans-serif;color:#000000;}
 .ft6p57{font-style:normal;font-weight:bold;font-size:21px;font-family:arial,sans-serif;color:#808080;}
 .ft7p57{font-style:normal;font-weight:normal;font-size:16px;font-family:arial,sans-serif;color:#000000;}

 /* Background Style */
 .styleBackground57{position:absolute;left:97px;top:899px}

 /* Navigation Styles */
 .styleNavBarTop{position:absolute;left:0px;top:2px}
 .nb{position:absolute;left:2px;top:0px}
 .nbs{position:absolute;left:0px;top:0px}
 .nbe{position:absolute;left:836px;top:0px}
 .styleNavBarBot{position:absolute;left:0px;top:1117px}
-->
</STYLE>
<!--End of page styles-->

</head>
<body bgcolor="#ffffff" text="#000000" link="#0000FF" Vlink="#660099">

<table id="pageTable" width="836" STYLE="position: relative; left: auto; top: auto;"><tr><td>
<div class=nbs><img src="./navbarstart.gif" width="2" height="30"></div>
<div class=nb><img src="./navbar.gif" width="836" height="30" alt="Navigation bar"></div>
<div class=nbe><img src="./navbarend.gif" width="2" height="30"></div>
<div class=styleNavBarTop>
<table width="834" height="26" border="0" cellspacing="0">
  <tr align="left">
    <td width="4">&nbsp;</td>
    <td width="25" align="center"><a href="http://www.gravitybox.com" target="_parent"><img src="./home.gif" border="0" alt="Home"></a></td>
    <td width="25" align="center"><a href="#" onClick="window.open('./print.html','Printing','width=300,height=100,toolbar=no,directories=no');return false;"><img src="./print.gif" border="0" alt="Print document"></a></td>
    <td width="10" align="center"><img src="./separator.gif" border="0"></td>
    <td width="18" align="center"><a href="./index1.html"><img src="./start.gif" width="18" height="14" border="0" alt="Start"></a></td>
    <td width="18" align="center"><a href="./index56.html"><img src="./back.gif" width="14" height="14" border="0" alt="Previous page"></a></td>
    <td width="80" valign="middle"><table width="100%" height="16" border="0" cellspacing="1" bgcolor="#ACA899"><tr><td align="center" bgcolor="#ffffff"><font face=verdana,arial,sans-serif><font size="1">&nbsp;57 of 234&nbsp;</font></font></td></tr></table></td>
    <td width="18" align="center"><a href="./index58.html"><img src="./forward.gif" width="14" height="14" border="0" alt="Next page"></a></td>
    <td width="18" align="center"><a href="./index234.html"><img src="./end.gif" width="18" height="14" border="0" alt="End"></a></td>
    <td width="620">&nbsp;</td>
  </tr>
</table>
<p>
</div>
<nobr>
<div class=styleBackground57><img src="./background57.png" width="633" height="156" border="0" alt=""></div>
<div class=ts57p0><span class="ft0p57"> </span></div>
<div class=ts57p1><span class="ft0p57">Gravitybox Schedule Primer<span class="ft1p57"> </span></span></div>
<div class=ts57p3><span class="ft0p57">Page 55&nbsp; </span></div>
<div class=ts57p7><span class="ft2p57"> </span></div>
<div class=ts57p8><span class="ft3p57"> </span></div>
<div class=ts57p9><span class="ft4p57">1998&#45;2004 Gravitybox Software LLC<span class="ft3p57"> </span></span></div>
<div class=ts57p13><span class="ft5p57">Chapter 5 </span></div>
<div class=ts57p15><span class="ft6p57">Database Access </span></div>
<div class=ts57p17><span class="ft7p57">In Chapter 4, we learned how to save and load information to files. This may work on a </span></div>
<div class=ts57p18><span class="ft7p57">limited scale. In this scenario, all schedules are saved in their own separate files. This </span></div>
<div class=ts57p19><span class="ft7p57">makes searching through multiple schedules extremely difficult. For a serious </span></div>
<div class=ts57p21><span class="ft7p57">application, you need the power of a database. A database can be your repository of </span></div>
<div class=ts57p22><span class="ft7p57">appointments and other information that may be loaded, searched, and saved at will. </span></div>
<div class=ts57p23><span class="ft7p57">You may also only load the information you need. It is possible to accumulate years of </span></div>
<div class=ts57p25><span class="ft7p57">appointment data. You defiantly would not want to load every appointment for 10 years </span></div>
<div class=ts57p26><span class="ft7p57">just to see today&#146;s appointments. This is the muscle of a database used in conjunction </span></div>
<div class=ts57p27><span class="ft7p57">with the schedule. This chapter basically creates an example application and perhaps </span></div>
<div class=ts57p29><span class="ft7p57">should be in the examples section; however it pertains more to the database access </span></div>
<div class=ts57p30><span class="ft7p57">category than it does to the example category. This is actually another example </span></div>
<div class=ts57p31><span class="ft7p57">application and its code may be downloaded from the Gravitybox website. </span></div>
<div class=ts57p34><span class="ft7p57"> </span></div>
<div class=ts57p35><span class="ft7p57"> </span></div>
<div class=ts57p36><span class="ft6p57">Creating the Table Structure </span></div>
<div class=ts57p38><span class="ft7p57">The first thing to be done is to create the table structure. We need to decide on a </span></div>
<div class=ts57p39><span class="ft7p57">structure that will save all of our information in an efficient format. Let us assume that </span></div>
<div class=ts57p41><span class="ft7p57">we are building an application to schedule patients. We will need to keep up with the </span></div>
<div class=ts57p42><span class="ft7p57">patients as well as their appointments. </span></div>
<div class=ts57p44><span class="ft7p57"> </span></div>
<div class=ts57p45><span class="ft7p57">We will define a simple scheduling database. We will build an application that displays </span></div>
<div class=ts57p46><span class="ft7p57">the rooms of an office, so the schedule will be in room&#45;only mode. We will display each </span></div>
<div class=ts57p50><span class="ft7p57">day in a separate window and make all schedules MDI child windows. This will organize </span></div>
<div class=ts57p51><span class="ft7p57">the display somewhat so that the user may view one day in a window. We will assume </span></div>
<div class=ts57p52><span class="ft7p57">that we need to add the functionality to setup categories and rooms as well. </span></div>
<div class=ts57p55><span class="ft7p57"> </span></div>
<div class=ts57p56><span class="ft7p57">We will need three tables: Category, Room, and Schedule. These will save all of the </span></div>
<div class=ts57p57><span class="ft7p57">information that is needed to construct a fully functional database scheduling </span></div>
<div class=ts57p58><span class="ft7p57">application. The first two tables are configuration tables and the last table stores the </span></div>
<div class=ts57p60><span class="ft7p57">appointments. For a bare&#45;bones application we would really only need the Schedule </span></div>
<div class=ts57p63><span class="ft7p57">table, but we are going to allow the user to configure categories and rooms as well. </span></div>
<div class=ts57p65><span class="ft7p57"> </span></div>
<div class=ts57p66><span class="ft7p57">We start with the &#147;Room&#148; table. It will store each room that is to be displayed. The table </span></div>
<div class=ts57p68><span class="ft7p57">structure follows. </span></div>
<div class=ts57p70><span class="ft7p57"> </span></div>
<div class=ts57p71><span class="ft7p57">RoomId&nbsp; AutoNumber </span></div>
<div class=ts57p73><span class="ft7p57">Name&nbsp; String </span></div>
<div class=ts57p75><span class="ft7p57">SortOrder&nbsp; Long Integer </span></div>
<div class=ts57p77><span class="ft7p57"> </span></div>
<div class=styleNavBarBot>
<table width="836" border="0" cellspacing="2">
  <tr></tr>
  <tr>
    <td width="118"><a href="http://www.purepage.com"><img src="./smalllogo.gif" width="118" height="46" border="0" alt="http://www.purepage.com"></a></td>
    <td></td>
  </tr>
</table>
</div>

</td></tr></table>

</body>
</html>
